//
//  NetWork.h
//  Project
//
//  Created by 冯东辉 on 2018/9/11.
//  Copyright © 2018年 FengDongHui. All rights reserved.
//

#import <Foundation/Foundation.h>

/**
 *  缓存设置枚举
 *
 *  CacheDurationInSeconds_NO        不设缓存
 *  CacheDurationInSeconds_Days_1    1天缓存周期
 *  CacheDurationInSeconds_Minutes_1 1分钟缓存周期,
 */
enum enumCacheDuration{
    CacheDurationInSeconds_NO           = -1,
    CacheDurationInSeconds_Days_1       = (60*60*24*1),
    CacheDurationInSeconds_Minutes_1    = (60*1),
    CacheDurationInSeconds_1            = 1,
};

@interface NetWork : NSObject

+(NetWork*)sharedInstance;

/**
 异步Post请求

 @param data 当前业务所需数据
 @param timeout 请求超时时间
 @param urlString 请求地址
 @param successed_handler 成功返回
 @param failed_handler 失败返回
 */
-(void)asyncPostHttpRequest:(NSDictionary*)data
                    timeout:(NSTimeInterval)timeout
                  urlMethod:(NSString *)urlString
          successed_handler:(void (^)(NSDictionary* jsonDic))successed_handler
             failed_handler:(void (^)(NSInteger statusCode,NSData* data))failed_handler;

/**
 异步Get请求

 @param data 当前业务所需数据
 @param timeout 请求超时时间
 @param urlString 请求地址
 @param successed_handler 成功返回
 @param failed_handler 失败返回
 */
-(void)asyncGetHttpRequest:(NSDictionary*)data
                   timeout:(NSTimeInterval)timeout
                 urlMethod:(NSString *)urlString
         successed_handler:(void (^)(NSDictionary *json))successed_handler
            failed_handler:(void (^)(NSInteger statusCode,NSData* data))failed_handler;

/**
 异步Post请求 上传文件

 @param data 当前业务所需数据
 @param fileData 文件数据
 @param fileName 文件名称
 @param timeout 请求超时时间
 @param urlString 请求地址
 @param successed_handler 成功返回
 @param failed_handler 失败返回
 */
-(void)asyncPostHttpRequest:(NSDictionary*)data
                   fileData:(NSArray *)fileData
                   fileName:(NSString *)fileName
                    timeout:(NSTimeInterval)timeout
                  urlMethod:(NSString *)urlString
          successed_handler:(void (^)(NSDictionary* jsonDic))successed_handler
             failed_handler:(void (^)(NSInteger statusCode,NSData* data))failed_handler;


@end
